package ar.com.cema.methodology.analyzer.services.persistence;

import java.io.Serializable;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.springframework.stereotype.Component;

/**
 * Generic DAO for managing objects.
 *
 * @author Matias Suarez
 */
@Component("simpleDAO")
@SuppressWarnings("rawtypes") 
public interface SimpleDAO {

	Object save(Object obj);

	void update(Object obj);

	Object merge(Object obj);

	void delete(Class theClass, Integer id);
	
	void delete(Object obj);

	Object load(Class theClass, Serializable id);

	Query createQuery(String queryString);

	Criteria createCriteria(Class persistentClass);
	
	Criteria createCriteria(Class persistentClass, String alias);
	
	Query getNameQuery(String queryName);
	
	
	/**
	 * Create a new instance of <tt>SQLQuery</tt> for the given SQL query string.
	 *
	 * @param queryString a SQL query
	 * @return SQLQuery
	 */
	SQLQuery createSQLQuery(String queryString);

}